package com.java.demo1;

import java.util.Arrays;

public class Demo1 {


    public static void main(String[] args) {
//    System.out.println("Java基础");
        //动态初始化
        int[] arr = new int[10];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = i;
        }
        //输出数组arr内存空间地址
        System.out.println(arr);
        System.out.println(Arrays.toString(arr));

        String[] strArr = new String[10];
        for (int i = 0; i < strArr.length; i++) {
            strArr[i] = String.valueOf(arr[i]);
        }
        System.out.println(Arrays.toString(strArr));


        //数组静态初始化
        int[] arr2 = {1, 2, 3, 4, 5};
        System.out.println(arr2[0]);
        int max = arr2[0];
        for (int i = 1; i < arr2.length; i++) {
            if (arr2[i] > max) {
                max = arr2[i];
            }
        }
        System.out.println(max);

    }
}